package com.example.highclasscomponent.Util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    public static String getTimeStr()
    {
        SimpleDateFormat sdf=new SimpleDateFormat("HH:mm:ss");
         return sdf.format(new Date());
    }
    public static String getDateStr(Calendar calendar)
    {
        Date date = calendar.getTime();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        String format = sdf.format(date);
        return format;
    }
    public static String getMonthStr(Calendar calendar)
    {
        Date date = calendar.getTime();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");
        String format = sdf.format(date);
        return format;
    }
}

